package com.sailing.core.java.util;

import java.util.HashMap;
import java.util.Map;

public class MapTest {

    /**
     * 测试map put方法返回值
     */
    static void testPutReturnVal(){

        Map<String,Integer> map = new HashMap<>(2);
        final String key = "a";
        Integer val = map.put(key,1);
        System.out.println("first time put, val===>"+val);
        Integer val1 = map.put(key, 2);
        System.out.println("not first time put, val ===>"+val1);

    }

    public static void main(String[] args) {
        testPutReturnVal();
    }
}
